/*******************************************************************************
 * Package: com.hngtrust.iir.company.service.impl
 * Type:    FinanceServiceImpl
 * Date:    2021-5-26 9:47
 *
 * Copyright (c) 2021 HUANENG GUICHENG TRUST CORP.,LTD All Rights Reserved.
 *
 * You may not use this file except in compliance with the License.
 *******************************************************************************/
package com.hngtrust.iir.company.service.impl;

import com.hngtrust.framework.id.service.MyIdGenerator;
import com.hngtrust.framework.page.service.PageService;
import com.hngtrust.iir.base.service.DictService;
import com.hngtrust.iir.company.controller.field.AssetDebtField;
import com.hngtrust.iir.company.controller.field.CashFlowField;
import com.hngtrust.iir.company.controller.field.ProfitField;
import com.hngtrust.iir.company.controller.vo.FinanceQuarterChangeRespVO;
import com.hngtrust.iir.company.controller.vo.FinanceYearChangeRespVO;
import com.hngtrust.iir.company.controller.vo.ListAssetDebtReqVO;
import com.hngtrust.iir.company.controller.vo.ListAssetDebtRespVO;
import com.hngtrust.iir.company.controller.vo.ListAssetStructRespVO;
import com.hngtrust.iir.company.controller.vo.ListCashFlowRespVO;
import com.hngtrust.iir.company.controller.vo.ListCashStructRespVO;
import com.hngtrust.iir.company.controller.vo.ListHolderReqVO;
import com.hngtrust.iir.company.controller.vo.ListProfitRespVO;
import com.hngtrust.iir.company.controller.vo.ListProfitStructRespVO;
import com.hngtrust.iir.company.entity.CompAssetDebt;
import com.hngtrust.iir.company.entity.CompCashFlow;
import com.hngtrust.iir.company.entity.CompProfit;
import com.hngtrust.iir.company.service.CompAssetDebtService;
import com.hngtrust.iir.company.service.CompCashFlowService;
import com.hngtrust.iir.company.service.CompProfitService;
import com.hngtrust.iir.company.service.FinanceService;
import com.hngtrust.iir.constant.Constant;
import com.hngtrust.iir.util.DateUtils;
import com.hngtrust.iir.util.ListUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

/**
 * 公司财务信息
 *
 * @author Chentianyong
 * @date 2021-5-26 9:47
 */
@Service
@Slf4j
public class FinanceServiceImpl implements FinanceService {
    @Autowired
    private CompAssetDebtService compAssetDebtService;
    
    @Autowired
    private CompProfitService compProfitService;
    
    @Autowired
    private CompCashFlowService compCashFlowService;
    
    @Autowired
    private DictService dictService;

    /**
     * 主键生成器
     */
    @Autowired
    private MyIdGenerator myIdGenerator;


    /**
     * 分页服务
     */
    @Autowired
    private PageService pageService;
    
    @Override
    public List<ListAssetDebtRespVO> listAssetDebt(ListAssetDebtReqVO req) {
        CompAssetDebt compAssetDebt = new CompAssetDebt();
        BeanUtils.copyProperties(req,compAssetDebt);
        compAssetDebt.setStatus(Constant.DEFAULT_STATUS_NORMAL);
        List<CompAssetDebt> list = new ArrayList<>();
        if(req.getType() == 2){  //按季统计
            compAssetDebt.setReportPeriod(DateUtils.getDate(req.getYear()+"-01-01"));
            list = compAssetDebtService.queryQuarterReport(compAssetDebt);
            //查检和补充4个季度数据
            Boolean quarter1 = false;
            Boolean quarter2 = false;
            Boolean quarter3 = false;
            Boolean quarter4 = false;
            for(CompAssetDebt obj : list){
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-03-31"))){
                    quarter1 = true;
                }
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-06-30"))){
                    quarter2 = true;
                }
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-09-30"))){
                    quarter3 = true;
                }
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-12-31"))){
                    quarter4 = true;
                }
            }
            if(!quarter1){
                CompAssetDebt debt = new CompAssetDebt();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-03-31"));
                debt.setCompId(req.getCompId());
                list.add(0,debt);
            }
            if(!quarter2){
                CompAssetDebt debt = new CompAssetDebt();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-06-30"));
                debt.setCompId(req.getCompId());
                list.add(1,debt);
            }
            if(!quarter3){
                CompAssetDebt debt = new CompAssetDebt();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-09-30"));
                debt.setCompId(req.getCompId());
                list.add(2,debt);
            }
            if(!quarter4){
                CompAssetDebt debt = new CompAssetDebt();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(3,debt);
            }
        }
        else {
            list = compAssetDebtService.queryYearReport(compAssetDebt);
            //处理最近5年
            Boolean year1 = false;
            Boolean year2 = false;
            Boolean year3 = false;
            Boolean year4 = false;
            Boolean year5 = false;
            for(CompAssetDebt obj : list){
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 1){
                    year1 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 2){
                    year2 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 3){
                    year3 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 4){
                    year4 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 5){
                    year5 = true;
                }
            }
            if(!year1){
                CompAssetDebt debt = new CompAssetDebt();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 1) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(0,debt);
            }
            if(!year2){
                CompAssetDebt debt = new CompAssetDebt();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 2) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(1,debt);
            }
            if(!year3){
                CompAssetDebt debt = new CompAssetDebt();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 3) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(2,debt);
            }
            if(!year4){
                CompAssetDebt debt = new CompAssetDebt();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 4) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(3,debt);
            }
            if(!year5){
                CompAssetDebt debt = new CompAssetDebt();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 5) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(4,debt);
            }
            
        }
        if(list.size() > 5){
            list = list.subList(0,5);
        }
        //处理空值数据
        try{
            for(CompAssetDebt obj : list){
                obj.setDiv(req.getDiv());
                compAssetDebtService.processNull(obj);
                if(null != req.getDiv() && req.getDiv() > 1){
                    this.objectDiv(obj,BigDecimal.valueOf(req.getDiv()));
                }
            }
        }catch (Exception e) {
            log.error("数据转换处理异常:{}", e);
        }
        
        List<ListAssetDebtRespVO> resp = new ArrayList<>();
        ListUtil<ListAssetDebtRespVO> listUtil = BeanUtils.instantiateClass(ListUtil.class);
        listUtil.copyList(list,resp,ListAssetDebtRespVO.class);

        return resp;
    }

    @Override
    public List<ListAssetDebtRespVO> listFinaAnaly(ListAssetDebtReqVO req) {
        CompAssetDebt compAssetDebt = new CompAssetDebt();
        BeanUtils.copyProperties(req,compAssetDebt);
        compAssetDebt.setStatus(Constant.DEFAULT_STATUS_NORMAL);
        List<CompAssetDebt> list = new ArrayList<>();
         {
             compAssetDebt.setReportPeriod(DateUtils.getDate(req.getYear()+"-12-31"));
             list = compAssetDebtService.queryYearReportAnaly(compAssetDebt);
            //处理最近2年
            Boolean year1 = false;
            Boolean year2 = false;

            for(CompAssetDebt obj : list){
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 1){
                    year1 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 2){
                    year2 = true;
                }

            }
            if(!year1){
                CompAssetDebt debt = new CompAssetDebt();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 1) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(0,debt);
            }
            if(!year2){
                CompAssetDebt debt = new CompAssetDebt();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 2) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(1,debt);
            }
        }
        if(list.size() > 2){
            list = list.subList(0,2);
        }
        //处理空值数据
        try{
            for(CompAssetDebt obj : list){
                obj.setDiv(req.getDiv());
                compAssetDebtService.processNull(obj);
                if(null != req.getDiv() && req.getDiv() > 1){
                    this.objectDiv(obj,BigDecimal.valueOf(req.getDiv()));
                }
            }
        }catch (Exception e) {
            log.error("数据转换处理异常:{}", e);
        }

        List<ListAssetDebtRespVO> resp = new ArrayList<>();
        List<ListAssetDebtRespVO> respResult = new ArrayList<>();
        ListUtil<ListAssetDebtRespVO> listUtil = BeanUtils.instantiateClass(ListUtil.class);
        listUtil.copyList(list,resp,ListAssetDebtRespVO.class);
        //第一列数据
        respResult.add(resp.get(0));
        //第二列占比%
        ListAssetDebtRespVO listAssetDebtRespVO2 = new ListAssetDebtRespVO();
        listAssetDebtRespVO2.setId(myIdGenerator.nextId());
        listAssetDebtRespVO2.setCompId(req.getCompId());
        listAssetDebtRespVO2.setReportPeriod(resp.get(0).getReportPeriod());
        listAssetDebtRespVO2.setMonetaryCap((resp.get(0).getMonetaryCap() != null && resp.get(0).getTotLiabShrhldrEqy() != null) ?  resp.get(0).getMonetaryCap().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setTradableFinAssets(resp.get(0).getTradableFinAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getTradableFinAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setDerivativeFinAssets(resp.get(0).getDerivativeFinAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getDerivativeFinAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setNotesRcv(resp.get(0).getNotesRcv() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getNotesRcv().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setAcctRcv(resp.get(0).getAcctRcv() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getAcctRcv().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setPrepay(resp.get(0).getPrepay() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getPrepay().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setOthRcv(resp.get(0).getOthRcv() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOthRcv().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setIntRcv(resp.get(0).getIntRcv() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getIntRcv().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setDvdRcv(resp.get(0).getDvdRcv() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getDvdRcv().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setOthRcv2(resp.get(0).getOthRcv2() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOthRcv2().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setInventories(resp.get(0).getInventories() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getInventories().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setHfsAssets(resp.get(0).getHfsAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getHfsAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setNonCurAssets1y(resp.get(0).getNonCurAssets1y() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getNonCurAssets1y().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setOthCurAssets(resp.get(0).getOthCurAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOthCurAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setTotCurAssets(resp.get(0).getTotCurAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getTotCurAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setFinAssetsAvail(resp.get(0).getFinAssetsAvail() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getFinAssetsAvail().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setHeldToMtyInvest(resp.get(0).getHeldToMtyInvest() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getHeldToMtyInvest().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setLongTermRec(resp.get(0).getLongTermRec() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getLongTermRec().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setLongTermEqyInvest(resp.get(0).getLongTermEqyInvest() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getLongTermEqyInvest().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setInvestRealEstate(resp.get(0).getInvestRealEstate() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getInvestRealEstate().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setStmBsTot(resp.get(0).getStmBsTot() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getStmBsTot().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setFixAssets(resp.get(0).getFixAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getFixAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setFixAssetsDisp(resp.get(0).getFixAssetsDisp() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getFixAssetsDisp().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setConstInProgTot(resp.get(0).getConstInProgTot() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getConstInProgTot().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setConstInProg(resp.get(0).getConstInProg() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getConstInProg().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setProjMatl(resp.get(0).getProjMatl() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getProjMatl().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setProductiveBioAssets(resp.get(0).getProductiveBioAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getProductiveBioAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setOilGasAssets(resp.get(0).getOilGasAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOilGasAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setIntangAssets(resp.get(0).getIntangAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getIntangAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setRAndDCosts(resp.get(0).getRAndDCosts() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getRAndDCosts().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setGoodwill(resp.get(0).getGoodwill() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getGoodwill().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setLongTermDeferredExp(resp.get(0).getLongTermDeferredExp() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getLongTermDeferredExp().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setDeferredTaxAssets(resp.get(0).getDeferredTaxAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getDeferredTaxAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setOthNonCurAssets(resp.get(0).getOthNonCurAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOthNonCurAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setTotNonCurAssets(resp.get(0).getTotNonCurAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getTotNonCurAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setTotAssets(resp.get(0).getTotAssets() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getTotAssets().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setStBorrow(resp.get(0).getStBorrow() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getStBorrow().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setTradableFinLiab(resp.get(0).getTradableFinLiab() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getTradableFinLiab().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setDerivativeFinLiab(resp.get(0).getDerivativeFinLiab() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getDerivativeFinLiab().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setNotesPayable(resp.get(0).getNotesPayable() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getNotesPayable().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setAcctPayable(resp.get(0).getAcctPayable() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getAcctPayable().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setAdvFromCust(resp.get(0).getAdvFromCust() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getAdvFromCust().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setEmplBenPayable(resp.get(0).getEmplBenPayable() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getEmplBenPayable().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setTaxesSurchargesPayable(resp.get(0).getTaxesSurchargesPayable() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getTaxesSurchargesPayable().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setOthPayableTot(resp.get(0).getOthPayableTot() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOthPayableTot().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setIntPayable(resp.get(0).getIntPayable() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getIntPayable().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setDvdPayable(resp.get(0).getDvdPayable() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getDvdPayable().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setOthPayable(resp.get(0).getOthPayable() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOthPayable().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setHfsSales(resp.get(0).getHfsSales() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getHfsSales().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setNonCurLiabDue1y(resp.get(0).getNonCurLiabDue1y() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getNonCurLiabDue1y().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setOthCurLiab(resp.get(0).getOthCurLiab() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOthCurLiab().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setTotCurLiab(resp.get(0).getTotCurLiab() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getTotCurLiab().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setLtBorrow(resp.get(0).getLtBorrow() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getLtBorrow().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setBondsPayable(resp.get(0).getBondsPayable() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getBondsPayable().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setLtPayableTot(resp.get(0).getLtPayableTot() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getLtPayableTot().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setLtPayable(resp.get(0).getLtPayable() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getLtPayable().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setSpecificItemPayable(resp.get(0).getSpecificItemPayable() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getSpecificItemPayable().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setProvisions(resp.get(0).getProvisions() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getProvisions().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setDeferredInc(resp.get(0).getDeferredInc() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getDeferredInc().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setDeferredTaxLiab(resp.get(0).getDeferredTaxLiab() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getDeferredTaxLiab().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setOthNonCurLiab(resp.get(0).getOthNonCurLiab() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOthNonCurLiab().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setTotNonCurLiab(resp.get(0).getTotNonCurLiab() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getTotNonCurLiab().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setTotLiab(resp.get(0).getTotLiab() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getTotLiab().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setOwnerRight(resp.get(0).getOwnerRight() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOwnerRight().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setCapStk(resp.get(0).getCapStk() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getCapStk().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setOtherEquityTools(resp.get(0).getOtherEquityTools() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOtherEquityTools().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setOtherEquityToolsPShr(resp.get(0).getOtherEquityToolsPShr() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOtherEquityToolsPShr().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setOtherSustainableBond(resp.get(0).getOtherSustainableBond() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOtherSustainableBond().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setCapRsrv(resp.get(0).getCapRsrv() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getCapRsrv().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setLessTsyStk(resp.get(0).getLessTsyStk() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getLessTsyStk().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setOtherCompIncome(resp.get(0).getOtherCompIncome() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getOtherCompIncome().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setSpecialRsrv(resp.get(0).getSpecialRsrv() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getSpecialRsrv().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setSurplusRsrv(resp.get(0).getSurplusRsrv() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getSurplusRsrv().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO2.setUndistributedProfit(resp.get(0).getUndistributedProfit() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getUndistributedProfit().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setTotShrhldrEqyIncl(resp.get(0).getTotShrhldrEqyIncl() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getTotShrhldrEqyIncl().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setTotLiabShrhldrEqy(resp.get(0).getTotLiabShrhldrEqy() != null && resp.get(0).getTotLiabShrhldrEqy() != null ? resp.get(0).getTotLiabShrhldrEqy().divide(resp.get(0).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO2.setDiv(req.getDiv());
        respResult.add(listAssetDebtRespVO2);

        //第三列数据
        respResult.add(resp.get(1));
        //第四列占比%
        ListAssetDebtRespVO listAssetDebtRespVO4 = new ListAssetDebtRespVO();
        listAssetDebtRespVO4.setId(myIdGenerator.nextId());
        listAssetDebtRespVO4.setCompId(req.getCompId());
        listAssetDebtRespVO4.setReportPeriod(resp.get(1).getReportPeriod());
        listAssetDebtRespVO4.setMonetaryCap((resp.get(1).getMonetaryCap() != null && resp.get(1).getTotLiabShrhldrEqy() != null) ? resp.get(1).getMonetaryCap().divide(resp.get(1).getTotLiabShrhldrEqy(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP) : null);
        listAssetDebtRespVO4.setTradableFinAssets(resp.get(1).getTradableFinAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getTradableFinAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setDerivativeFinAssets(resp.get(1).getDerivativeFinAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getDerivativeFinAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setNotesRcv(resp.get(1).getNotesRcv() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getNotesRcv().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setAcctRcv(resp.get(1).getAcctRcv() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getAcctRcv().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setPrepay(resp.get(1).getPrepay() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getPrepay().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setOthRcv(resp.get(1).getOthRcv() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOthRcv().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setIntRcv(resp.get(1).getIntRcv() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getIntRcv().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setDvdRcv(resp.get(1).getDvdRcv() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getDvdRcv().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setOthRcv2(resp.get(1).getOthRcv2() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOthRcv2().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setInventories(resp.get(1).getInventories() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getInventories().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setHfsAssets(resp.get(1).getHfsAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getHfsAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setNonCurAssets1y(resp.get(1).getNonCurAssets1y() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getNonCurAssets1y().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setOthCurAssets(resp.get(1).getOthCurAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOthCurAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setTotCurAssets(resp.get(1).getTotCurAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getTotCurAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setFinAssetsAvail(resp.get(1).getFinAssetsAvail() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getFinAssetsAvail().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setHeldToMtyInvest(resp.get(1).getHeldToMtyInvest() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getHeldToMtyInvest().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setLongTermRec(resp.get(1).getLongTermRec() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getLongTermRec().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setLongTermEqyInvest(resp.get(1).getLongTermEqyInvest() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getLongTermEqyInvest().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setInvestRealEstate(resp.get(1).getInvestRealEstate() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getInvestRealEstate().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setStmBsTot(resp.get(1).getStmBsTot() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getStmBsTot().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setFixAssets(resp.get(1).getFixAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getFixAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setFixAssetsDisp(resp.get(1).getFixAssetsDisp() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getFixAssetsDisp().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setConstInProgTot(resp.get(1).getConstInProgTot() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getConstInProgTot().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setConstInProg(resp.get(1).getConstInProg() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getConstInProg().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setProjMatl(resp.get(1).getProjMatl() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getProjMatl().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setProductiveBioAssets(resp.get(1).getProductiveBioAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getProductiveBioAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setOilGasAssets(resp.get(1).getOilGasAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOilGasAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setIntangAssets(resp.get(1).getIntangAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getIntangAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setRAndDCosts(resp.get(1).getRAndDCosts() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getRAndDCosts().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setGoodwill(resp.get(1).getGoodwill() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getGoodwill().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setLongTermDeferredExp(resp.get(1).getLongTermDeferredExp() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getLongTermDeferredExp().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setDeferredTaxAssets(resp.get(1).getDeferredTaxAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getDeferredTaxAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setOthNonCurAssets(resp.get(1).getOthNonCurAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOthNonCurAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setTotNonCurAssets(resp.get(1).getTotNonCurAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getTotNonCurAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setTotAssets(resp.get(1).getTotAssets() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getTotAssets().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setStBorrow(resp.get(1).getStBorrow() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getStBorrow().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setTradableFinLiab(resp.get(1).getTradableFinLiab() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getTradableFinLiab().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setDerivativeFinLiab(resp.get(1).getDerivativeFinLiab() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getDerivativeFinLiab().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setNotesPayable(resp.get(1).getNotesPayable() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getNotesPayable().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setAcctPayable(resp.get(1).getAcctPayable() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getAcctPayable().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setAdvFromCust(resp.get(1).getAdvFromCust() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getAdvFromCust().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setEmplBenPayable(resp.get(1).getEmplBenPayable() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getEmplBenPayable().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setTaxesSurchargesPayable(resp.get(1).getTaxesSurchargesPayable() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getTaxesSurchargesPayable().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setOthPayableTot(resp.get(1).getOthPayableTot() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOthPayableTot().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setIntPayable(resp.get(1).getIntPayable() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getIntPayable().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setDvdPayable(resp.get(1).getDvdPayable() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getDvdPayable().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setOthPayable(resp.get(1).getOthPayable() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOthPayable().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setHfsSales(resp.get(1).getHfsSales() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getHfsSales().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setNonCurLiabDue1y(resp.get(1).getNonCurLiabDue1y() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getNonCurLiabDue1y().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setOthCurLiab(resp.get(1).getOthCurLiab() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOthCurLiab().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setTotCurLiab(resp.get(1).getTotCurLiab() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getTotCurLiab().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setLtBorrow(resp.get(1).getLtBorrow() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getLtBorrow().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setBondsPayable(resp.get(1).getBondsPayable() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getBondsPayable().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setLtPayableTot(resp.get(1).getLtPayableTot() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getLtPayableTot().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setLtPayable(resp.get(1).getLtPayable() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getLtPayable().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setSpecificItemPayable(resp.get(1).getSpecificItemPayable() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getSpecificItemPayable().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setProvisions(resp.get(1).getProvisions() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getProvisions().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setDeferredInc(resp.get(1).getDeferredInc() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getDeferredInc().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setDeferredTaxLiab(resp.get(1).getDeferredTaxLiab() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getDeferredTaxLiab().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setOthNonCurLiab(resp.get(1).getOthNonCurLiab() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOthNonCurLiab().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setTotNonCurLiab(resp.get(1).getTotNonCurLiab() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getTotNonCurLiab().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setTotLiab(resp.get(1).getTotLiab() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getTotLiab().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setOwnerRight(resp.get(1).getOwnerRight() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOwnerRight().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setCapStk(resp.get(1).getCapStk() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getCapStk().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setOtherEquityTools(resp.get(1).getOtherEquityTools() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOtherEquityTools().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setOtherEquityToolsPShr(resp.get(1).getOtherEquityToolsPShr() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOtherEquityToolsPShr().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setOtherSustainableBond(resp.get(1).getOtherSustainableBond() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOtherSustainableBond().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setCapRsrv(resp.get(1).getCapRsrv() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getCapRsrv().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setLessTsyStk(resp.get(1).getLessTsyStk() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getLessTsyStk().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setOtherCompIncome(resp.get(1).getOtherCompIncome() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getOtherCompIncome().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setSpecialRsrv(resp.get(1).getSpecialRsrv() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getSpecialRsrv().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setSurplusRsrv(resp.get(1).getSurplusRsrv() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getSurplusRsrv().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)   : null);
        listAssetDebtRespVO4.setUndistributedProfit(resp.get(1).getUndistributedProfit() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getUndistributedProfit().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setTotShrhldrEqyIncl(resp.get(1).getTotShrhldrEqyIncl() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getTotShrhldrEqyIncl().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setTotLiabShrhldrEqy(resp.get(1).getTotLiabShrhldrEqy() != null && resp.get(1).getTotLiabShrhldrEqy() != null ? resp.get(1).getTotLiabShrhldrEqy().divide(resp.get(1).getTotLiabShrhldrEqy(),Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP)  : null);
        listAssetDebtRespVO4.setDiv(req.getDiv());
        respResult.add(listAssetDebtRespVO4);

        //占比变动%
        ListAssetDebtRespVO listAssetDebtRespVO = new ListAssetDebtRespVO();
        listAssetDebtRespVO.setId(myIdGenerator.nextId());
        listAssetDebtRespVO.setCompId(req.getCompId());
        listAssetDebtRespVO.setMonetaryCap((respResult.get(1).getMonetaryCap() != null && respResult.get(3).getMonetaryCap() != null) ? respResult.get(1).getMonetaryCap().subtract(respResult.get(3).getMonetaryCap()) : null);
        listAssetDebtRespVO.setTradableFinAssets(respResult.get(1).getTradableFinAssets() != null && respResult.get(3).getTradableFinAssets() != null ? respResult.get(1).getTradableFinAssets().subtract(respResult.get(3).getTradableFinAssets()) : null);
        listAssetDebtRespVO.setDerivativeFinAssets(respResult.get(1).getDerivativeFinAssets() != null && respResult.get(3).getDerivativeFinAssets() != null ? respResult.get(1).getDerivativeFinAssets().subtract(respResult.get(3).getDerivativeFinAssets()) : null);
        listAssetDebtRespVO.setNotesRcv(respResult.get(1).getNotesRcv() != null && respResult.get(3).getNotesRcv() != null ? respResult.get(1).getNotesRcv().subtract(respResult.get(3).getNotesRcv()) : null);
        listAssetDebtRespVO.setAcctRcv(respResult.get(1).getAcctRcv() != null && respResult.get(3).getAcctRcv() != null ? respResult.get(1).getAcctRcv().subtract(respResult.get(3).getAcctRcv()) : null);
        listAssetDebtRespVO.setPrepay(respResult.get(1).getPrepay() != null && respResult.get(3).getPrepay() != null ? respResult.get(1).getPrepay().subtract(respResult.get(3).getPrepay()) : null);
        listAssetDebtRespVO.setOthRcv(respResult.get(1).getOthRcv() != null && respResult.get(3).getOthRcv() != null ? respResult.get(1).getOthRcv().subtract(respResult.get(3).getOthRcv()) : null);
        listAssetDebtRespVO.setIntRcv(respResult.get(1).getIntRcv() != null && respResult.get(3).getIntRcv() != null ? respResult.get(1).getIntRcv().subtract(respResult.get(3).getIntRcv()) : null);
        listAssetDebtRespVO.setDvdRcv(respResult.get(1).getDvdRcv() != null && respResult.get(3).getDvdRcv() != null ? respResult.get(1).getDvdRcv().subtract(respResult.get(3).getDvdRcv()) : null);
        listAssetDebtRespVO.setOthRcv2(respResult.get(1).getOthRcv2() != null && respResult.get(3).getOthRcv2() != null ? respResult.get(1).getOthRcv2().subtract(respResult.get(3).getOthRcv2()) : null);
        listAssetDebtRespVO.setInventories(respResult.get(1).getInventories() != null && respResult.get(3).getInventories() != null ? respResult.get(1).getInventories().subtract(respResult.get(3).getInventories()) : null);
        listAssetDebtRespVO.setHfsAssets(respResult.get(1).getHfsAssets() != null && respResult.get(3).getHfsAssets() != null ? respResult.get(1).getHfsAssets().subtract(respResult.get(3).getHfsAssets()) : null);
        listAssetDebtRespVO.setNonCurAssets1y(respResult.get(1).getNonCurAssets1y() != null && respResult.get(3).getNonCurAssets1y() != null ? respResult.get(1).getNonCurAssets1y().subtract(respResult.get(3).getNonCurAssets1y()) : null);
        listAssetDebtRespVO.setOthCurAssets(respResult.get(1).getOthCurAssets() != null && respResult.get(3).getOthCurAssets() != null ? respResult.get(1).getOthCurAssets().subtract(respResult.get(3).getOthCurAssets()) : null);
        listAssetDebtRespVO.setTotCurAssets(respResult.get(1).getTotCurAssets() != null && respResult.get(3).getTotAssets() != null ? respResult.get(1).getTotCurAssets().subtract(respResult.get(3).getTotAssets()) : null);
        listAssetDebtRespVO.setFinAssetsAvail(respResult.get(1).getFinAssetsAvail() != null && respResult.get(3).getFinAssetsAvail() != null ? respResult.get(1).getFinAssetsAvail().subtract(respResult.get(3).getFinAssetsAvail()) : null);
        listAssetDebtRespVO.setHeldToMtyInvest(respResult.get(1).getHeldToMtyInvest() != null && respResult.get(3).getHeldToMtyInvest() != null ? respResult.get(1).getHeldToMtyInvest().subtract(respResult.get(3).getHeldToMtyInvest()) : null);
        listAssetDebtRespVO.setLongTermRec(respResult.get(1).getLongTermRec() != null && respResult.get(3).getLongTermRec() != null ? respResult.get(1).getLongTermRec().subtract(respResult.get(3).getLongTermRec()) : null);
        listAssetDebtRespVO.setLongTermEqyInvest(respResult.get(1).getLongTermEqyInvest() != null && respResult.get(3).getLongTermEqyInvest() != null ? respResult.get(1).getLongTermEqyInvest().subtract(respResult.get(3).getLongTermEqyInvest()) : null);
        listAssetDebtRespVO.setInvestRealEstate(respResult.get(1).getInvestRealEstate() != null && respResult.get(3).getInvestRealEstate() != null ? respResult.get(1).getInvestRealEstate().subtract(respResult.get(3).getInvestRealEstate()) : null);
        listAssetDebtRespVO.setStmBsTot(respResult.get(1).getStmBsTot() != null && respResult.get(3).getStmBsTot() != null ? respResult.get(1).getStmBsTot().subtract(respResult.get(3).getStmBsTot()) : null);
        listAssetDebtRespVO.setFixAssets(respResult.get(1).getFixAssets() != null && respResult.get(3).getFixAssets() != null ? respResult.get(1).getFixAssets().subtract(respResult.get(3).getFixAssets()) : null);
        listAssetDebtRespVO.setFixAssetsDisp(respResult.get(1).getFixAssetsDisp() != null && respResult.get(3).getFixAssetsDisp() != null ? respResult.get(1).getFixAssetsDisp().subtract(respResult.get(3).getFixAssetsDisp()) : null);
        listAssetDebtRespVO.setConstInProgTot(respResult.get(1).getConstInProgTot() != null && respResult.get(3).getConstInProgTot() != null ? respResult.get(1).getConstInProgTot().subtract(respResult.get(3).getConstInProgTot()) : null);
        listAssetDebtRespVO.setConstInProg(respResult.get(1).getConstInProg() != null && respResult.get(3).getConstInProg() != null ? respResult.get(1).getConstInProg().subtract(respResult.get(3).getConstInProg()) : null);
        listAssetDebtRespVO.setProjMatl(respResult.get(1).getProjMatl() != null && respResult.get(3).getProjMatl() != null ? respResult.get(1).getProjMatl().subtract(respResult.get(3).getProjMatl()) : null);
        listAssetDebtRespVO.setProductiveBioAssets(respResult.get(1).getProductiveBioAssets() != null && respResult.get(3).getProductiveBioAssets() != null ? respResult.get(1).getProductiveBioAssets().subtract(respResult.get(3).getProductiveBioAssets()) : null);
        listAssetDebtRespVO.setOilGasAssets(respResult.get(1).getOilGasAssets() != null && respResult.get(3).getOilGasAssets() != null ? respResult.get(1).getOilGasAssets().subtract(respResult.get(3).getOilGasAssets()) : null);
        listAssetDebtRespVO.setIntangAssets(respResult.get(1).getIntangAssets() != null && respResult.get(3).getIntangAssets() != null ? respResult.get(1).getIntangAssets().subtract(respResult.get(3).getIntangAssets()) : null);
        listAssetDebtRespVO.setRAndDCosts(respResult.get(1).getRAndDCosts() != null && respResult.get(3).getRAndDCosts() != null ? respResult.get(1).getRAndDCosts().subtract(respResult.get(3).getRAndDCosts()) : null);
        listAssetDebtRespVO.setGoodwill(respResult.get(1).getGoodwill() != null && respResult.get(3).getGoodwill() != null ? respResult.get(1).getGoodwill().subtract(respResult.get(3).getGoodwill()) : null);
        listAssetDebtRespVO.setLongTermDeferredExp(respResult.get(1).getLongTermDeferredExp() != null && respResult.get(3).getLongTermDeferredExp() != null ? respResult.get(1).getLongTermDeferredExp().subtract(respResult.get(3).getLongTermDeferredExp()) : null);
        listAssetDebtRespVO.setDeferredTaxAssets(respResult.get(1).getDeferredTaxAssets() != null && respResult.get(3).getDeferredTaxAssets() != null ? respResult.get(1).getDeferredTaxAssets().subtract(respResult.get(3).getDeferredTaxAssets()) : null);
        listAssetDebtRespVO.setOthNonCurAssets(respResult.get(1).getOthNonCurAssets() != null && respResult.get(3).getOthNonCurAssets() != null ? respResult.get(1).getOthNonCurAssets().subtract(respResult.get(3).getOthNonCurAssets()) : null);
        listAssetDebtRespVO.setTotNonCurAssets(respResult.get(1).getTotNonCurAssets() != null && respResult.get(3).getTotNonCurAssets() != null ? respResult.get(1).getTotNonCurAssets().subtract(respResult.get(3).getTotNonCurAssets()) : null);
        listAssetDebtRespVO.setTotAssets(respResult.get(1).getTotAssets() != null && respResult.get(3).getTotCurAssets() != null ? respResult.get(1).getTotAssets().subtract(respResult.get(3).getTotCurAssets()) : null);
        listAssetDebtRespVO.setStBorrow(respResult.get(1).getStBorrow() != null && respResult.get(3).getStBorrow() != null ? respResult.get(1).getStBorrow().subtract(respResult.get(3).getStBorrow()) : null);
        listAssetDebtRespVO.setTradableFinLiab(respResult.get(1).getTradableFinLiab() != null && respResult.get(3).getTradableFinLiab() != null ? respResult.get(1).getTradableFinLiab().subtract(respResult.get(3).getTradableFinLiab()) : null);
        listAssetDebtRespVO.setDerivativeFinLiab(respResult.get(1).getDerivativeFinLiab() != null && respResult.get(3).getDerivativeFinLiab() != null ? respResult.get(1).getDerivativeFinLiab().subtract(respResult.get(3).getDerivativeFinLiab()) : null);
        listAssetDebtRespVO.setNotesPayable(respResult.get(1).getNotesPayable() != null && respResult.get(3).getNotesPayable() != null ? respResult.get(1).getNotesPayable().subtract(respResult.get(3).getNotesPayable()) : null);
        listAssetDebtRespVO.setAcctPayable(respResult.get(1).getAcctPayable() != null && respResult.get(3).getAcctPayable() != null ? respResult.get(1).getAcctPayable().subtract(respResult.get(3).getAcctPayable()) : null);
        listAssetDebtRespVO.setAdvFromCust(respResult.get(1).getAdvFromCust() != null && respResult.get(3).getAdvFromCust() != null ? respResult.get(1).getAdvFromCust().subtract(respResult.get(3).getAdvFromCust()) : null);
        listAssetDebtRespVO.setEmplBenPayable(respResult.get(1).getEmplBenPayable() != null && respResult.get(3).getEmplBenPayable() != null ? respResult.get(1).getEmplBenPayable().subtract(respResult.get(3).getEmplBenPayable()) : null);
        listAssetDebtRespVO.setTaxesSurchargesPayable(respResult.get(1).getTaxesSurchargesPayable() != null && respResult.get(3).getTaxesSurchargesPayable() != null ? respResult.get(1).getTaxesSurchargesPayable().subtract(respResult.get(3).getTaxesSurchargesPayable()) : null);
        listAssetDebtRespVO.setOthPayableTot(respResult.get(1).getOthPayableTot() != null && respResult.get(3).getOthPayableTot() != null ? respResult.get(1).getOthPayableTot().subtract(respResult.get(3).getOthPayableTot()) : null);
        listAssetDebtRespVO.setIntPayable(respResult.get(1).getIntPayable() != null && respResult.get(3).getIntPayable() != null ? respResult.get(1).getIntPayable().subtract(respResult.get(3).getIntPayable()) : null);
        listAssetDebtRespVO.setDvdPayable(respResult.get(1).getDvdPayable() != null && respResult.get(3).getDvdPayable() != null ? respResult.get(1).getDvdPayable().subtract(respResult.get(3).getDvdPayable()) : null);
        listAssetDebtRespVO.setOthPayable(respResult.get(1).getOthPayable() != null && respResult.get(3).getOthPayable() != null ? respResult.get(1).getOthPayable().subtract(respResult.get(3).getOthPayable()) : null);
        listAssetDebtRespVO.setHfsSales(respResult.get(1).getHfsSales() != null && respResult.get(3).getHfsSales() != null ? respResult.get(1).getHfsSales().subtract(respResult.get(3).getHfsSales()) : null);
        listAssetDebtRespVO.setNonCurLiabDue1y(respResult.get(1).getNonCurLiabDue1y() != null && respResult.get(3).getNonCurLiabDue1y() != null ? respResult.get(1).getNonCurLiabDue1y().subtract(respResult.get(3).getNonCurLiabDue1y()) : null);
        listAssetDebtRespVO.setOthCurLiab(respResult.get(1).getOthCurLiab() != null && respResult.get(3).getOthCurLiab() != null ? respResult.get(1).getOthCurLiab().subtract(respResult.get(3).getOthCurLiab()) : null);
        listAssetDebtRespVO.setTotCurLiab(respResult.get(1).getTotCurLiab() != null && respResult.get(3).getTotCurLiab() != null ? respResult.get(1).getTotCurLiab().subtract(respResult.get(3).getTotCurLiab()) : null);
        listAssetDebtRespVO.setLtBorrow(respResult.get(1).getLtBorrow() != null && respResult.get(3).getLtBorrow() != null ? respResult.get(1).getLtBorrow().subtract(respResult.get(3).getLtBorrow()) : null);
        listAssetDebtRespVO.setBondsPayable(respResult.get(1).getBondsPayable() != null && respResult.get(3).getBondsPayable() != null ? respResult.get(1).getBondsPayable().subtract(respResult.get(3).getBondsPayable()) : null);
        listAssetDebtRespVO.setLtPayableTot(respResult.get(1).getLtPayableTot() != null && respResult.get(3).getLtPayableTot() != null ? respResult.get(1).getLtPayableTot().subtract(respResult.get(3).getLtPayableTot()) : null);
        listAssetDebtRespVO.setLtPayable(respResult.get(1).getLtPayable() != null && respResult.get(3).getLtPayable() != null ? respResult.get(1).getLtPayable().subtract(respResult.get(3).getLtPayable()) : null);
        listAssetDebtRespVO.setSpecificItemPayable(respResult.get(1).getSpecificItemPayable() != null && respResult.get(3).getSpecificItemPayable() != null ? respResult.get(1).getSpecificItemPayable().subtract(respResult.get(3).getSpecificItemPayable()) : null);
        listAssetDebtRespVO.setProvisions(respResult.get(1).getProvisions() != null && respResult.get(3).getProvisions() != null ? respResult.get(1).getProvisions().subtract(respResult.get(3).getProvisions()) : null);
        listAssetDebtRespVO.setDeferredInc(respResult.get(1).getDeferredInc() != null && respResult.get(3).getDeferredInc() != null ? respResult.get(1).getDeferredInc().subtract(respResult.get(3).getDeferredInc()) : null);
        listAssetDebtRespVO.setDeferredTaxLiab(respResult.get(1).getDeferredTaxLiab() != null && respResult.get(3).getDeferredTaxLiab() != null ? respResult.get(1).getDeferredTaxLiab().subtract(respResult.get(3).getDeferredTaxLiab()) : null);
        listAssetDebtRespVO.setOthNonCurLiab(respResult.get(1).getOthNonCurLiab() != null && respResult.get(3).getOthNonCurLiab() != null ? respResult.get(1).getOthNonCurLiab().subtract(respResult.get(3).getOthNonCurLiab()) : null);
        listAssetDebtRespVO.setTotNonCurLiab(respResult.get(1).getTotNonCurLiab() != null && respResult.get(3).getTotNonCurLiab() != null ? respResult.get(1).getTotNonCurLiab().subtract(respResult.get(3).getTotNonCurLiab()) : null);
        listAssetDebtRespVO.setTotLiab(respResult.get(1).getTotLiab() != null && respResult.get(3).getTotLiab() != null ? respResult.get(1).getTotLiab().subtract(respResult.get(3).getTotLiab()) : null);
        listAssetDebtRespVO.setOwnerRight(respResult.get(1).getOwnerRight() != null && respResult.get(3).getOwnerRight() != null ? respResult.get(1).getOwnerRight().subtract(respResult.get(3).getOwnerRight()) : null);
        listAssetDebtRespVO.setCapRsrv(respResult.get(1).getCapRsrv() != null && respResult.get(3).getCapRsrv() != null ? respResult.get(1).getCapRsrv().subtract(respResult.get(3).getCapRsrv()) : null);
        listAssetDebtRespVO.setOtherEquityTools(respResult.get(1).getOtherEquityTools() != null && respResult.get(3).getOtherEquityTools() != null ? respResult.get(1).getOtherEquityTools().subtract(respResult.get(3).getOtherEquityTools()) : null);
        listAssetDebtRespVO.setOtherEquityToolsPShr(respResult.get(1).getOtherEquityToolsPShr() != null && respResult.get(3).getOtherEquityToolsPShr() != null ? respResult.get(1).getOtherEquityToolsPShr().subtract(respResult.get(3).getOtherEquityToolsPShr()) : null);
        listAssetDebtRespVO.setOtherSustainableBond(respResult.get(1).getOtherSustainableBond() != null && respResult.get(3).getOtherSustainableBond() != null ? respResult.get(1).getOtherSustainableBond().subtract(respResult.get(3).getOtherSustainableBond()) : null);
        listAssetDebtRespVO.setCapRsrv(respResult.get(1).getCapRsrv() != null && respResult.get(3).getCapRsrv() != null ? respResult.get(1).getCapRsrv().subtract(respResult.get(3).getCapRsrv()) : null);
        listAssetDebtRespVO.setLessTsyStk(respResult.get(1).getLessTsyStk() != null && respResult.get(3).getLessTsyStk() != null ? respResult.get(1).getLessTsyStk().subtract(respResult.get(3).getLessTsyStk()) : null);
        listAssetDebtRespVO.setOtherCompIncome(respResult.get(1).getOtherCompIncome() != null && respResult.get(3).getOtherCompIncome() != null ? respResult.get(1).getOtherCompIncome().subtract(respResult.get(3).getOtherCompIncome()) : null);
        listAssetDebtRespVO.setSpecialRsrv(respResult.get(1).getSpecialRsrv() != null && respResult.get(3).getSpecialRsrv() != null ? respResult.get(1).getSpecialRsrv().subtract(respResult.get(3).getSpecialRsrv()) : null);
        listAssetDebtRespVO.setSurplusRsrv(respResult.get(1).getSurplusRsrv() != null && respResult.get(3).getSurplusRsrv() != null ? respResult.get(1).getSurplusRsrv().subtract(respResult.get(3).getSurplusRsrv()) : null);
        listAssetDebtRespVO.setUndistributedProfit(respResult.get(1).getUndistributedProfit() != null && respResult.get(3).getUndistributedProfit() != null ? respResult.get(1).getUndistributedProfit().subtract(respResult.get(3).getUndistributedProfit()) : null);
        listAssetDebtRespVO.setTotShrhldrEqyIncl(respResult.get(1).getTotShrhldrEqyIncl() != null && respResult.get(3).getTotShrhldrEqyIncl() != null ? respResult.get(1).getTotShrhldrEqyIncl().subtract(respResult.get(3).getTotShrhldrEqyIncl()) : null);
        listAssetDebtRespVO.setTotLiabShrhldrEqy(respResult.get(1).getTotLiabShrhldrEqy() != null && respResult.get(3).getTotLiabShrhldrEqy() != null ? respResult.get(1).getTotLiabShrhldrEqy().subtract(respResult.get(3).getTotLiabShrhldrEqy()) : null);
        listAssetDebtRespVO.setDiv(req.getDiv());
        respResult.add(listAssetDebtRespVO);
        return respResult;
    }

    @Override
    public List<ListAssetDebtRespVO> listAssetDebtTrend(ListAssetDebtReqVO req) {
        CompAssetDebt compAssetDebt = new CompAssetDebt();
        BeanUtils.copyProperties(req,compAssetDebt);
        compAssetDebt.setStatus(Constant.DEFAULT_STATUS_NORMAL);
        List<CompAssetDebt> list = new ArrayList<>();
        list = compAssetDebtService.queryYearReport10(compAssetDebt);
        //处理空值数据
        try{
            for(CompAssetDebt obj : list){
                obj.setDiv(req.getDiv());
                compAssetDebtService.processNull(obj);
                if(null != req.getDiv() && req.getDiv() > 1){
                    this.objectDiv(obj,BigDecimal.valueOf(req.getDiv()));
                }
            }
        }catch (Exception e) {
            log.error("数据转换处理异常:{}", e);
        }
        
        List<ListAssetDebtRespVO> resp = new ArrayList<>();
        ListUtil<ListAssetDebtRespVO> listUtil = BeanUtils.instantiateClass(ListUtil.class);
        listUtil.copyList(list,resp,ListAssetDebtRespVO.class);
        
        return resp;
    }
    
    @Override
    public List<ListProfitRespVO> listProfit(ListAssetDebtReqVO req) {
        CompProfit compProfit = new CompProfit();
        BeanUtils.copyProperties(req,compProfit);
        compProfit.setStatus(Constant.DEFAULT_STATUS_NORMAL);
        List<CompProfit> list = new ArrayList<>();
        if(req.getType() == 2){  //按季统计
            compProfit.setReportPeriod(DateUtils.getDate(req.getYear()+"-01-01"));
            list = compProfitService.queryQuarterReport(compProfit);
            //查检和补充4个季度数据
            Boolean quarter1 = false;
            Boolean quarter2 = false;
            Boolean quarter3 = false;
            Boolean quarter4 = false;
            for(CompProfit obj : list){
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-03-31"))){
                    quarter1 = true;
                }
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-06-30"))){
                    quarter2 = true;
                }
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-09-30"))){
                    quarter3 = true;
                }
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-12-31"))){
                    quarter4 = true;
                }
            }
            if(!quarter1){
                CompProfit debt = new CompProfit();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-03-31"));
                debt.setCompId(req.getCompId());
                list.add(0,debt);
            }
            if(!quarter2){
                CompProfit debt = new CompProfit();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-06-30"));
                debt.setCompId(req.getCompId());
                list.add(1,debt);
            }
            if(!quarter3){
                CompProfit debt = new CompProfit();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-09-30"));
                debt.setCompId(req.getCompId());
                list.add(2,debt);
            }
            if(!quarter4){
                CompProfit debt = new CompProfit();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(3,debt);
            }
    
        }
        else {
            list = compProfitService.queryYearReport(compProfit);
            //处理最近5年
            Boolean year1 = false;
            Boolean year2 = false;
            Boolean year3 = false;
            Boolean year4 = false;
            Boolean year5 = false;
            for(CompProfit obj : list){
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 1){
                    year1 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 2){
                    year2 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 3){
                    year3 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 4){
                    year4 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 5){
                    year5 = true;
                }
            }
            if(!year1){
                CompProfit debt = new CompProfit();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 1) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(0,debt);
            }
            if(!year2){
                CompProfit debt = new CompProfit();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 2) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(1,debt);
            }
            if(!year3){
                CompProfit debt = new CompProfit();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 3) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(2,debt);
            }
            if(!year4){
                CompProfit debt = new CompProfit();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 4) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(3,debt);
            }
            if(!year5){
                CompProfit debt = new CompProfit();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 5) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(4,debt);
            }
    
        }
        if(list.size() > 5){
            list = list.subList(0,5);
        }

        //处理空值数据
        try{
            for(CompProfit obj : list){
                obj.setDiv(req.getDiv());
                compProfitService.processNull(obj);
                if(null != req.getDiv() && req.getDiv() > 1){
                    this.objectDiv(obj,BigDecimal.valueOf(req.getDiv()));
                }
            }
        }catch (Exception e) {
            log.error("数据转换处理异常:{}", e);
        }
        
        List<ListProfitRespVO> resp = new ArrayList<>();
        ListUtil<ListProfitRespVO> listUtil = BeanUtils.instantiateClass(ListUtil.class);
        listUtil.copyList(list,resp,ListProfitRespVO.class);
    
        return resp;
    }
    
    @Override
    public List<ListProfitRespVO> listProfitTrend(ListAssetDebtReqVO req) {
        CompProfit compProfit = new CompProfit();
        BeanUtils.copyProperties(req,compProfit);
        compProfit.setStatus(Constant.DEFAULT_STATUS_NORMAL);
        List<CompProfit> list = new ArrayList<>();
        list = compProfitService.queryYearReport10(compProfit);
    
        //处理空值数据
        try{
            for(CompProfit obj : list){
                obj.setDiv(req.getDiv());
                compProfitService.processNull(obj);
                if(null != req.getDiv() && req.getDiv() > 1){
                    this.objectDiv(obj,BigDecimal.valueOf(req.getDiv()));
                }
            }
        }catch (Exception e) {
            log.error("数据转换处理异常:{}", e);
        }

        List<ListProfitRespVO> resp = new ArrayList<>();
        ListUtil<ListProfitRespVO> listUtil = BeanUtils.instantiateClass(ListUtil.class);
        listUtil.copyList(list,resp,ListProfitRespVO.class);
        
        return resp;
    }
    
    @Override
    public List<ListCashFlowRespVO> listCashFlow(ListAssetDebtReqVO req) {
        CompCashFlow compCashFlow = new CompCashFlow();
        BeanUtils.copyProperties(req,compCashFlow);
        compCashFlow.setStatus(Constant.DEFAULT_STATUS_NORMAL);
        List<CompCashFlow> list = new ArrayList<>();
        if(req.getType() == 2){  //按季统计
            compCashFlow.setReportPeriod(DateUtils.getDate(req.getYear()+"-01-01"));
            list = compCashFlowService.queryQuarterReport(compCashFlow);
            //查检和补充4个季度数据
            Boolean quarter1 = false;
            Boolean quarter2 = false;
            Boolean quarter3 = false;
            Boolean quarter4 = false;
            for(CompCashFlow obj : list){
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-03-31"))){
                    quarter1 = true;
                }
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-06-30"))){
                    quarter2 = true;
                }
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-09-30"))){
                    quarter3 = true;
                }
                if(obj.getReportPeriod().equals(DateUtils.getDate(req.getYear()+"-12-31"))){
                    quarter4 = true;
                }
            }
            if(!quarter1){
                CompCashFlow debt = new CompCashFlow();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-03-31"));
                debt.setCompId(req.getCompId());
                list.add(0,debt);
            }
            if(!quarter2){
                CompCashFlow debt = new CompCashFlow();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-06-30"));
                debt.setCompId(req.getCompId());
                list.add(1,debt);
            }
            if(!quarter3){
                CompCashFlow debt = new CompCashFlow();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-09-30"));
                debt.setCompId(req.getCompId());
                list.add(2,debt);
            }
            if(!quarter4){
                CompCashFlow debt = new CompCashFlow();
                debt.setReportPeriod(DateUtils.getDate(req.getYear()+"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(3,debt);
            }
        }
        else {
            list = compCashFlowService.queryYearReport(compCashFlow);
            //处理最近5年
            Boolean year1 = false;
            Boolean year2 = false;
            Boolean year3 = false;
            Boolean year4 = false;
            Boolean year5 = false;
            for(CompCashFlow obj : list){
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 1){
                    year1 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 2){
                    year2 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 3){
                    year3 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 4){
                    year4 = true;
                }
                if(DateUtils.getYear(obj.getReportPeriod()) == DateUtils.getYear(new Date()) - 5){
                    year5 = true;
                }
            }
            if(!year1){
                CompCashFlow debt = new CompCashFlow();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 1) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(0,debt);
            }
            if(!year2){
                CompCashFlow debt = new CompCashFlow();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 2) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(1,debt);
            }
            if(!year3){
                CompCashFlow debt = new CompCashFlow();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 3) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(2,debt);
            }
            if(!year4){
                CompCashFlow debt = new CompCashFlow();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 4) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(3,debt);
            }
            if(!year5){
                CompCashFlow debt = new CompCashFlow();
                debt.setReportPeriod(DateUtils.getDate(String.valueOf(DateUtils.getYear(new Date()) - 5) +"-12-31"));
                debt.setCompId(req.getCompId());
                list.add(4,debt);
            }
        }
        if(list.size() > 5){
            list = list.subList(0,5);
        }

        //处理空值数据
        try{
            for(CompCashFlow obj : list){
                obj.setDiv(req.getDiv());
                compCashFlowService.processNull(obj);
                if(null != req.getDiv() && req.getDiv() > 1){
                    this.objectDiv(obj,BigDecimal.valueOf(req.getDiv()));
                }
            }
        }catch (Exception e) {
            log.error("数据转换处理异常:{}", e);
        }
        
        List<ListCashFlowRespVO> resp = new ArrayList<>();
        ListUtil<ListCashFlowRespVO> listUtil = BeanUtils.instantiateClass(ListUtil.class);
        listUtil.copyList(list,resp,ListCashFlowRespVO.class);
        
        return resp;
    }
    
    @Override
    public List<ListCashFlowRespVO> listCashFlowTrend(ListAssetDebtReqVO req) {
        CompCashFlow compCashFlow = new CompCashFlow();
        BeanUtils.copyProperties(req,compCashFlow);
        compCashFlow.setStatus(Constant.DEFAULT_STATUS_NORMAL);
        List<CompCashFlow> list = new ArrayList<>();
        list = compCashFlowService.queryYearReport10(compCashFlow);
        //处理空值数据
        try{
            for(CompCashFlow obj : list){
                obj.setDiv(req.getDiv());
                compCashFlowService.processNull(obj);
                if(null != req.getDiv() && req.getDiv() > 1){
                    this.objectDiv(obj,BigDecimal.valueOf(req.getDiv()));
                }
            }
        }catch (Exception e) {
            log.error("数据转换处理异常:{}", e);
        }

        List<ListCashFlowRespVO> resp = new ArrayList<>();
        ListUtil<ListCashFlowRespVO> listUtil = BeanUtils.instantiateClass(ListUtil.class);
        listUtil.copyList(list,resp,ListCashFlowRespVO.class);
        
        return resp;
    }
    
    @Override
    public ListAssetStructRespVO listAssetStruct(ListHolderReqVO req) {
        ListAssetDebtReqVO compAssetDebt = new ListAssetDebtReqVO();
        compAssetDebt.setCompId(req.getCompId());
        compAssetDebt.setType(1);
        List<ListAssetDebtRespVO> list = this.listAssetDebt(compAssetDebt);
        if(list.isEmpty()){
            return null;
        }
        ListAssetDebtRespVO debt = list.get(0);
    
        ListAssetStructRespVO resp = new ListAssetStructRespVO();
        resp.setCompId(req.getCompId());
        resp.setYear(String.valueOf(DateUtils.getYear(debt.getReportPeriod())));
        
        if(null != debt.getTotCurAssets() && null != debt.getTotAssets()) {
            resp.setCurAssetsRate(debt.getTotCurAssets()
                    .divide(debt.getTotAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(
                            BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        if(null != resp.getCurAssetsRate()) {
            resp.setNonAssetsRate(BigDecimal.valueOf(100).subtract(resp.getCurAssetsRate()));
            if (resp.getCurAssetsRate().compareTo(BigDecimal.valueOf(50)) > 0) {
                resp.setAssetsStr(String.format("总资产流动性：流动资产占据大多数（%s%%）", resp.getCurAssetsRate().toString()));
            } else if (resp.getCurAssetsRate().compareTo(BigDecimal.valueOf(50)) == 0) {
                resp.setAssetsStr("总资产流动性：流动资产与非流动资产规模大体相当");
            } else {
                resp.setAssetsStr(String.format("总资产流动性：非流动资产占据大多数（%s%%）", resp.getNonAssetsRate().toString()));
            }
        }
        
        if(null != debt.getTotCurLiab() && null != debt.getTotLiab()) {
            resp.setCurLiabRate(debt.getTotCurLiab()
                    .divide(debt.getTotLiab(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        if(null != resp.getCurLiabRate()) {
            resp.setNonLiabRate(BigDecimal.valueOf(100).subtract(resp.getCurLiabRate()));
            if (null != resp.getCurLiabRate()) {
                if (resp.getCurLiabRate().compareTo(BigDecimal.valueOf(50)) > 0) {
                    resp.setLiabStr(String.format("总负债流动性：流动负债为主（%s%%）", resp.getCurLiabRate().toString()));
                } else if (resp.getCurLiabRate().compareTo(BigDecimal.valueOf(50)) == 0) {
                    resp.setAssetsStr("总负债流动性：流动负债与非流动负债规模大体相当");
                } else {
                    resp.setLiabStr(String.format("总负债流动性：非流动负债为主（%s%%）", resp.getNonLiabRate().toString()));
                }
            }
        }
        
        if(null != debt.getMonetaryCap() && null != debt.getTotCurAssets()) {
            resp.setCashFundRate(debt.getMonetaryCap()
                    .divide(debt.getTotCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setCashFundRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getTradableFinAssets() && null != debt.getTotCurAssets()) {
            resp.setTradeAssetRate(debt.getTradableFinAssets()
                    .divide(debt.getTotCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setTradeAssetRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getAcctRcv() && null != debt.getTotCurAssets()) {
            resp.setReceivableRate(debt.getAcctRcv()
                    .divide(debt.getTotCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setReceivableRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getInventories() && null != debt.getTotCurAssets()) {
            resp.setInventoryRate(debt.getInventories()
                    .divide(debt.getTotCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setInventoryRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getPrepay() && null != debt.getTotCurAssets()) {
            resp.setAdvanceRate(debt.getPrepay()
                    .divide(debt.getTotCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setAdvanceRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getOthRcv() && null != debt.getTotCurAssets()) {
            resp.setOtherReceivableRate(debt.getOthRcv()
                    .divide(debt.getTotCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setOtherReceivableRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getHfsAssets() && null != debt.getTotCurAssets()) {
            resp.setHeldSaleRate(debt.getHfsAssets()
                    .divide(debt.getTotCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setHeldSaleRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getNonCurAssets1y() && null != debt.getTotCurAssets()) {
            resp.setNonCurAssets1yRate(debt.getNonCurAssets1y()
                    .divide(debt.getTotCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setNonCurAssets1yRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getOthCurAssets() && null != debt.getTotCurAssets()) {
            resp.setOthCurAssetsRate(debt.getOthCurAssets()
                    .divide(debt.getTotCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setOthCurAssetsRate(BigDecimal.valueOf(0));
        }
        resp.setOtherAssetRate(BigDecimal.valueOf(100).subtract(resp.getCashFundRate()).subtract(resp.getTradeAssetRate()).subtract(resp.getReceivableRate())
                .subtract(resp.getInventoryRate()).subtract(resp.getAdvanceRate()).subtract(resp.getOtherReceivableRate()).subtract(resp.getHeldSaleRate())
                .subtract(resp.getNonCurAssets1yRate()).subtract(resp.getOthCurAssetsRate()));
        //处理前5项
        List<ListAssetStructRespVO.SortItem> sortList = new ArrayList<>();
        sortList.add(new ListAssetStructRespVO.SortItem("货币资金",resp.getCashFundRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("交易性金融资产",resp.getTradeAssetRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("应收账款",resp.getReceivableRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("存货",resp.getInventoryRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("预付款项",resp.getAdvanceRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("其他应收款",resp.getOtherReceivableRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("持有待售资产",resp.getHeldSaleRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("一年内到期的非流动资产",resp.getNonCurAssets1yRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("其他流动资产",resp.getOthCurAssetsRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("其他",resp.getOtherAssetRate()));
        sortList.sort(Comparator.comparing(ListAssetStructRespVO.SortItem::getItemData,Comparator.nullsFirst(BigDecimal::compareTo)).reversed());
        String str = "";
        for(int i=0;i<5;i++){
            if(sortList.get(i).getItemData().compareTo(BigDecimal.valueOf(0)) > 0){
                if(str.isEmpty()){
                    str = sortList.get(i).getName();
                }
                else{
                    str += "、" + sortList.get(i).getName();
                }
            }
        }
        if(!str.isEmpty()){
            resp.setCurAssetsStr("流动资产结构："+str+"为主");
        }
    
        if(null != debt.getFinAssetsAvail() && null != debt.getTotNonCurAssets()) {
            resp.setFinAssetsAvailRate(debt.getFinAssetsAvail()
                    .divide(debt.getTotNonCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setFinAssetsAvailRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getHeldToMtyInvest() && null != debt.getTotNonCurAssets()) {
            resp.setHeldToMtyInvestRate(debt.getHeldToMtyInvest()
                    .divide(debt.getTotNonCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setHeldToMtyInvestRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getLongTermRec() && null != debt.getTotNonCurAssets()) {
            resp.setLongTermRecRate(debt.getLongTermRec()
                    .divide(debt.getTotNonCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setLongTermRecRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getLongTermEqyInvest() && null != debt.getTotNonCurAssets()) {
            resp.setLongTermEqyInvestRate(debt.getLongTermEqyInvest()
                    .divide(debt.getTotNonCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setLongTermEqyInvestRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getInvestRealEstate() && null != debt.getTotNonCurAssets()) {
            resp.setInvestRealEstateRate(debt.getInvestRealEstate()
                    .divide(debt.getTotNonCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setInvestRealEstateRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getFixAssets() && null != debt.getTotNonCurAssets()) {
            resp.setFixAssetsRate(debt.getFixAssets()
                    .divide(debt.getTotNonCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setFixAssetsRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getIntangAssets() && null != debt.getTotNonCurAssets()) {
            resp.setIntangAssetsRate(debt.getIntangAssets()
                    .divide(debt.getTotNonCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setIntangAssetsRate(BigDecimal.valueOf(0));
        }
        if(null != debt.getConstInProgTot() && null != debt.getTotNonCurAssets()) {
            resp.setConstInProgTotRate(debt.getConstInProgTot()
                    .divide(debt.getTotNonCurAssets(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        }
        else{
            resp.setConstInProgTotRate(BigDecimal.valueOf(0));
        }
        if(null != resp.getFinAssetsAvailRate() && null != resp.getHeldToMtyInvestRate() && null != resp.getLongTermRecRate() && null != resp.getLongTermEqyInvestRate()
                && null != resp.getInvestRealEstateRate() && null != resp.getFixAssetsRate() && null != resp.getIntangAssetsRate() && null != resp.getConstInProgTotRate()) {
            resp.setOtherRate(BigDecimal.valueOf(100).subtract(resp.getFinAssetsAvailRate()).subtract(resp.getHeldToMtyInvestRate()).subtract(resp.getLongTermRecRate())
                    .subtract(resp.getLongTermEqyInvestRate()).subtract(resp.getInvestRealEstateRate()).subtract(resp.getFixAssetsRate()).subtract(resp.getIntangAssetsRate())
                    .subtract(resp.getConstInProgTotRate()));
        }
        //处理前5项
        sortList = new ArrayList<>();
        sortList.add(new ListAssetStructRespVO.SortItem("可供出售金融资产",resp.getFinAssetsAvailRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("持有至到期投资",resp.getHeldToMtyInvestRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("长期应收款",resp.getLongTermRecRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("长期股权投资",resp.getLongTermEqyInvestRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("投资性房地产",resp.getInvestRealEstateRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("固定资产",resp.getFixAssetsRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("无形资产",resp.getIntangAssetsRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("在建工程",resp.getConstInProgTotRate()));
        sortList.add(new ListAssetStructRespVO.SortItem("其他",resp.getOtherRate()));
        sortList.sort(Comparator.comparing(ListAssetStructRespVO.SortItem::getItemData,Comparator.nullsFirst(BigDecimal::compareTo)).reversed());
        str = "";
        for(int i=0;i<5;i++){
            if(sortList.get(i).getItemData().compareTo(BigDecimal.valueOf(0)) > 0){
                if(str.isEmpty()){
                    str = sortList.get(i).getName();
                }
                else{
                    str += "、" + sortList.get(i).getName();
                }
            }
        }
        if(!str.isEmpty()){
            resp.setNonAssetsStr("非流动资产结构："+str+"为主");
        }
    
        return resp;
    }
    
    @Override
    public ListProfitStructRespVO listProfitStruct(ListHolderReqVO req) {
        ListAssetDebtReqVO compProfit = new ListAssetDebtReqVO();
        compProfit.setCompId(req.getCompId());
        compProfit.setType(1);
        List<ListProfitRespVO> list = this.listProfit(compProfit);
        if(list.isEmpty()){
            return null;
        }
        ListProfitRespVO profit = list.get(0);
    
        ListProfitStructRespVO resp = new ListProfitStructRespVO();
        resp.setCompId(req.getCompId());
        resp.setYear(String.valueOf(DateUtils.getYear(profit.getReportPeriod())));
    
        if(null != profit.getOperProfit() && null != profit.getTotProfit()
                && ((profit.getOperProfit().compareTo(BigDecimal.valueOf(0)) > 0 && profit.getTotProfit().compareTo(BigDecimal.valueOf(0)) > 0)
                || (profit.getOperProfit().compareTo(BigDecimal.valueOf(0)) < 0 && profit.getTotProfit().compareTo(BigDecimal.valueOf(0)) < 0))){
            if(null != profit.getOperProfit() && null != profit.getTotProfit()) {
                resp.setOperProfit(profit.getOperProfit()
                        .divide(profit.getTotProfit(), Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
                if(resp.getOperProfit().compareTo(BigDecimal.valueOf(100)) > 0){
                    resp.setOperProfit(BigDecimal.valueOf(100));
                }
            }
            if(null != resp.getOperProfit()) {
                resp.setPlusNonOperRev(BigDecimal.valueOf(100).subtract(resp.getOperProfit()));
            }
        
            if(null != resp.getOperProfit()) {
                if (resp.getOperProfit().compareTo(BigDecimal.valueOf(50)) > 0) {
                    resp.setProfitStr(String.format("利润结构：营业利润是利润的主要组成部分，营业外收支净额仅占%s%%", resp.getPlusNonOperRev().toString()));
                } else if (resp.getOperProfit().compareTo(BigDecimal.valueOf(50)) == 0) {
                    resp.setProfitStr("利润结构：营业利润和营业外收支净额大体相当");
                } else {
                    resp.setProfitStr(String.format("利润结构：营业外收支净额是利润的主要组成部分，营业利润仅占%s%%", resp.getOperProfit().toString()));
                }
            }
        }
    
        //成本结构分析
        BigDecimal costTotal = BigDecimal.valueOf(0);
        if(null != profit.getLessOperCost()) {
            costTotal = costTotal.add(profit.getLessOperCost());
        }
        if(null != profit.getLessTaxesSurchargesOps()) {
            costTotal = costTotal.add(profit.getLessTaxesSurchargesOps());
        }
        if(null != profit.getRdExpense()) {
            costTotal = costTotal.add(profit.getRdExpense());
        }
        if(null != profit.getLessFinExp()) {
            costTotal = costTotal.add(profit.getLessFinExp());
        }
        if(null != profit.getLessSellingDistExp()) {
            costTotal = costTotal.add(profit.getLessSellingDistExp());
        }
        if(null != profit.getLessGerlAdminExp()) {
            costTotal = costTotal.add(profit.getLessGerlAdminExp());
        }
    
        if(costTotal.compareTo(BigDecimal.valueOf(0)) > 0){
            if(null != profit.getLessOperCost()) {
                resp.setSalesCost(
                        profit.getLessOperCost().divide(costTotal, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setSalesCost(BigDecimal.valueOf(0));
            }
            if(null != profit.getLessTaxesSurchargesOps()) {
                resp.setLessTaxesSurchargesOps(profit.getLessTaxesSurchargesOps()
                        .divide(costTotal, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setLessTaxesSurchargesOps(BigDecimal.valueOf(0));
            }
            if(null != profit.getRdExpense()) {
                resp.setRdExpense(
                        profit.getRdExpense().divide(costTotal, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setRdExpense(BigDecimal.valueOf(0));
            }
            if(null != profit.getLessFinExp()) {
                resp.setFinExp(
                        profit.getLessFinExp().divide(costTotal, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setFinExp(BigDecimal.valueOf(0));
            }
            if(null != profit.getLessSellingDistExp()) {
                resp.setSellingDistExp(profit.getLessSellingDistExp()
                        .divide(costTotal, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setSellingDistExp(BigDecimal.valueOf(0));
            }
            if(null != profit.getLessGerlAdminExp()) {
                resp.setGerlAdminExp(profit.getLessGerlAdminExp()
                        .divide(costTotal, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setGerlAdminExp(BigDecimal.valueOf(0));
            }
            //处理由于四舍五入全部加起来不够100的问题
            if(resp.getSalesCost().add(resp.getLessTaxesSurchargesOps()).add(resp.getRdExpense()).add( resp.getFinExp().add(resp.getSellingDistExp()).add(resp.getGerlAdminExp())).compareTo(BigDecimal.valueOf(100)) != 0){
                if(resp.getSalesCost().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setSalesCost(BigDecimal.valueOf(100).subtract(resp.getLessTaxesSurchargesOps().add(resp.getRdExpense()).add( resp.getFinExp().add(resp.getSellingDistExp()).add(resp.getGerlAdminExp()))));
                }
                else if(resp.getLessTaxesSurchargesOps().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setLessTaxesSurchargesOps(BigDecimal.valueOf(100).subtract(resp.getSalesCost().add(resp.getRdExpense()).add( resp.getFinExp().add(resp.getSellingDistExp()).add(resp.getGerlAdminExp()))));
                }
                else if(resp.getRdExpense().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setRdExpense(BigDecimal.valueOf(100).subtract(resp.getSalesCost().add(resp.getLessTaxesSurchargesOps()).add( resp.getFinExp().add(resp.getSellingDistExp()).add(resp.getGerlAdminExp()))));
                }
                else if(resp.getFinExp().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setFinExp(BigDecimal.valueOf(100).subtract(resp.getSalesCost().add(resp.getRdExpense()).add( resp.getLessTaxesSurchargesOps().add(resp.getSellingDistExp()).add(resp.getGerlAdminExp()))));
                }
                else if(resp.getSellingDistExp().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setSellingDistExp(BigDecimal.valueOf(100).subtract(resp.getSalesCost().add(resp.getRdExpense()).add( resp.getFinExp().add(resp.getLessTaxesSurchargesOps()).add(resp.getGerlAdminExp()))));
                }
                else if(resp.getGerlAdminExp().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setGerlAdminExp(BigDecimal.valueOf(100).subtract(resp.getSalesCost().add(resp.getRdExpense()).add( resp.getFinExp().add(resp.getSellingDistExp()).add(resp.getLessTaxesSurchargesOps()))));
                }
            }
        
            resp.setOperCostStr(String.format("成本结构：营业成本占营业总成本的%s%%，税金及附加占%s%%，研发费用占%s%%，期间费用占%s%%，其中：财务费用%s%%、销售费用%s%%、管理费用%s%%",
                    resp.getSalesCost().toString(),
                    resp.getLessTaxesSurchargesOps().toString(),
                    resp.getRdExpense().toString(),
                    resp.getFinExp().add(resp.getSellingDistExp()).add(resp.getGerlAdminExp()).toString(),
                    resp.getFinExp().toString(),
                    resp.getSellingDistExp().toString(),
                    resp.getGerlAdminExp().toString()
            ));
        }
    
        return resp;
    }
    
    @Override
    public ListCashStructRespVO listCashStruct(ListHolderReqVO req) {
        ListAssetDebtReqVO compCash = new ListAssetDebtReqVO();
        compCash.setCompId(req.getCompId());
        compCash.setType(1);
        List<ListCashFlowRespVO> list = this.listCashFlow(compCash);
        if(list.isEmpty()){
            return null;
        }
        ListCashFlowRespVO cash = list.get(0);
    
        ListCashStructRespVO resp = new ListCashStructRespVO();
        resp.setCompId(req.getCompId());
        resp.setYear(String.valueOf(DateUtils.getYear(cash.getReportPeriod())));
        //现金流入结构分析
        BigDecimal stotCashIn = BigDecimal.valueOf(0);
        if(null != cash.getStotCashInflowsFncAct()) {
            stotCashIn = stotCashIn.add(cash.getStotCashInflowsFncAct());
        }
        if(null != cash.getStotCashInflowsInvAct()) {
            stotCashIn = stotCashIn.add(cash.getStotCashInflowsInvAct());
        }
        if(null != cash.getStotCashInflowsOperAct()) {
            stotCashIn = stotCashIn.add(cash.getStotCashInflowsOperAct());
        }
    
        if(stotCashIn.compareTo(BigDecimal.valueOf(0)) != 0){
            if(null != cash.getStotCashInflowsFncAct()) {
                resp.setStotCashInflowsFncAct(cash.getStotCashInflowsFncAct()
                        .divide(stotCashIn, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setStotCashInflowsFncAct(BigDecimal.valueOf(0));
            }
            if(null != cash.getStotCashInflowsInvAct()) {
                resp.setStotCashInflowsInvAct(cash.getStotCashInflowsInvAct()
                        .divide(stotCashIn, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setStotCashInflowsInvAct(BigDecimal.valueOf(0));
            }
            if(null != cash.getStotCashInflowsOperAct()) {
                resp.setStotCashInflowsOperAct(cash.getStotCashInflowsOperAct()
                        .divide(stotCashIn, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setStotCashInflowsOperAct(BigDecimal.valueOf(0));
            }
            
            //处理由于四舍五入全部加起来不够100的问题
            if(resp.getStotCashInflowsFncAct().add(resp.getStotCashInflowsInvAct()).add(resp.getStotCashInflowsOperAct()).compareTo(BigDecimal.valueOf(100)) != 0){
                if(resp.getStotCashInflowsFncAct().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setStotCashInflowsFncAct(BigDecimal.valueOf(100).subtract(resp.getStotCashInflowsInvAct().add(resp.getStotCashInflowsOperAct())));
                }
                else if(resp.getStotCashInflowsInvAct().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setStotCashInflowsInvAct(BigDecimal.valueOf(100).subtract(resp.getStotCashInflowsFncAct().add(resp.getStotCashInflowsOperAct())));
                }
                else if(resp.getStotCashInflowsOperAct().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setStotCashInflowsOperAct(BigDecimal.valueOf(100).subtract(resp.getStotCashInflowsInvAct().add(resp.getStotCashInflowsFncAct())));
                }
            }
        
            resp.setStotCashInStr(String.format("现金流入结构：经营活动产生的现金流入占%s%%，投资活动和筹资活动产生的现金流入分别占%s%%、%s%%",
                    resp.getStotCashInflowsOperAct().toString(),
                    resp.getStotCashInflowsInvAct().toString(),
                    resp.getStotCashInflowsFncAct().toString()
            ));
        }
    
        //现金流出结构分析
        BigDecimal stotCashOut = BigDecimal.valueOf(0);
        if(null != cash.getStotCashOutflowsFncAct()) {
            stotCashOut = stotCashOut.add(cash.getStotCashOutflowsFncAct());
        }
        if(null != cash.getStotCashOutflowsInvAct()) {
            stotCashOut = stotCashOut.add(cash.getStotCashOutflowsInvAct());
        }
        if(null != cash.getStotCashOutflowsOperAct()) {
            stotCashOut = stotCashOut.add(cash.getStotCashOutflowsOperAct());
        }
        if(stotCashOut.compareTo(BigDecimal.valueOf(0)) != 0){
            if(null != cash.getStotCashOutflowsFncAct()) {
                resp.setStotCashOutflowsFncAct(cash.getStotCashOutflowsFncAct()
                        .divide(stotCashOut, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setStotCashOutflowsFncAct(BigDecimal.valueOf(0));
            }
            if(null != cash.getStotCashOutflowsInvAct()) {
                resp.setStotCashOutflowsInvAct(cash.getStotCashOutflowsInvAct()
                        .divide(stotCashOut, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setStotCashOutflowsInvAct(BigDecimal.valueOf(0));
            }
            if(null != cash.getStotCashOutflowsOperAct()) {
                resp.setStotCashOutflowsOperAct(cash.getStotCashOutflowsOperAct()
                        .divide(stotCashOut, Constant.RETAIN_DECIMAL_DIGIT_SIX, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
            }
            else{
                resp.setStotCashOutflowsOperAct(BigDecimal.valueOf(0));
            }
    
            //处理由于四舍五入全部加起来不够100的问题
            if(resp.getStotCashOutflowsFncAct().add(resp.getStotCashOutflowsInvAct()).add(resp.getStotCashOutflowsOperAct()).compareTo(BigDecimal.valueOf(100)) != 0){
                if(resp.getStotCashOutflowsFncAct().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setStotCashOutflowsFncAct(BigDecimal.valueOf(100).subtract(resp.getStotCashOutflowsInvAct().add(resp.getStotCashOutflowsOperAct())));
                }
                else if(resp.getStotCashOutflowsInvAct().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setStotCashOutflowsInvAct(BigDecimal.valueOf(100).subtract(resp.getStotCashOutflowsFncAct().add(resp.getStotCashOutflowsOperAct())));
                }
                else if(resp.getStotCashOutflowsOperAct().compareTo(BigDecimal.valueOf(0)) > 0){
                    resp.setStotCashOutflowsOperAct(BigDecimal.valueOf(100).subtract(resp.getStotCashOutflowsInvAct().add(resp.getStotCashOutflowsFncAct())));
                }
            }
            
            resp.setStotCashOutStr(String.format("现金流出结构：经营活动产生的现金流出占%s%%，投资活动和筹资活动产生的现金流出分别占%s%%、%s%%",
                    resp.getStotCashOutflowsOperAct().toString(),
                    resp.getStotCashOutflowsInvAct().toString(),
                    resp.getStotCashOutflowsFncAct().toString()
            ));
        }
    
        return resp;
    }
    
    /**
     * 对数据做行列转换
     *
     * @param list 数据列表
     * @param type 数据类型 1年 2季
     */
    @Override
    public List<Object> changeFinanceData(List<?> list,Integer type,Object[] enumType) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        List<Object> resp = new ArrayList<>();
        //加单位
        Method getDiv = list.get(0).getClass().getMethod("getDiv");
        Integer intValue = (Integer)getDiv.invoke(list.get(0));
        String orgStr = "元";
        if (intValue==10000){
            orgStr = "万";
        }
        else if (intValue==1000000){
            orgStr = "百万";
        }
        else if (intValue==100000000){
            orgStr = "亿";
        }
       
        if(type.equals(2)){
            FinanceQuarterChangeRespVO org = new FinanceQuarterChangeRespVO();
            org.setCol4("单位：" + orgStr);
            resp.add(org);
        }
        else{
            FinanceYearChangeRespVO org = new FinanceYearChangeRespVO();
            org.setCol5("单位：" + orgStr);
            resp.add(org);
        }

        for(Object enumValue : enumType){
            String enumName = "";
            String enumCode = "";
            if(list.get(0) instanceof ListAssetDebtRespVO){
                AssetDebtField curEnum = (AssetDebtField) enumValue;
                enumName = curEnum.getName();
                enumCode = curEnum.getCode();
            }
            else if(list.get(0) instanceof ListProfitRespVO){
                ProfitField curEnum = (ProfitField) enumValue;
                enumName = curEnum.getName();
                enumCode = curEnum.getCode();
            }
            else if(list.get(0) instanceof ListCashFlowRespVO){
                CashFlowField curEnum = (CashFlowField) enumValue;
                enumName = curEnum.getName();
                enumCode = curEnum.getCode();
            }

            Object asset = null;
            if(type.equals(2)){
                asset = new FinanceQuarterChangeRespVO();
            }
            else{
                asset = new FinanceYearChangeRespVO();
            }
    
            Method setName = asset.getClass().getMethod("setName", new Class[] {String.class});
            Method setCol1 = asset.getClass().getMethod("setCol1", new Class[] {String.class});
            Method setCol2 = asset.getClass().getMethod("setCol2", new Class[] {String.class});
            Method setCol3 = asset.getClass().getMethod("setCol3", new Class[] {String.class});
            Method setCol4 = asset.getClass().getMethod("setCol4", new Class[] {String.class});
    
            if(enumCode.equals("year")){
                setName.invoke(asset,new Object[] {enumName});
                Method getReportPeriod = list.get(0).getClass().getMethod("getReportPeriod");
                if(type.equals(1)){
                    setCol1.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(0)))) + "年"});
                    setCol2.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(1)))) + "年"});
                    setCol3.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(2)))) + "年"});
                    setCol4.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(3)))) + "年"});
                    Method setCol5 = asset.getClass().getMethod("setCol5", new Class[] {String.class});
                    setCol5.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(4)))) + "年"});
                }
                else if(type.equals(2)){ //季报
                    setCol1.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(0)))) + "第一季度"});
                    setCol2.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(1)))) + "半年报"});
                    setCol3.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(2)))) + "第三季度"});
                    setCol4.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(3)))) + "第四季度"});
                }
                else if(type.equals(33)){ //财务信息结构分析导出表头
                    setCol1.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(0)))) + "年"});
                    setCol2.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(1)))) + "年占比%"});
                    setCol3.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(2)))) + "年"});
                    setCol4.invoke(asset,new Object[] {String.valueOf(DateUtils.getYear((Date)getReportPeriod.invoke(list.get(3)))) + "年占比%"});
                    Method setCol5 = asset.getClass().getMethod("setCol5", new Class[] {String.class});
                    setCol5.invoke(asset,new Object[] { "占比变动%"});
                }
            }
            else{
                setName.invoke(asset,new Object[] {enumName});
                String name = enumCode.substring(0,1).toUpperCase()+enumCode.substring(1); //将属性的首字符大写，方便构造get，set方法
                if(name.equals("Empt1") || name.equals("Empt2")){
                    continue;
                }
                Method m = list.get(0).getClass().getMethod("get"+name);
                BigDecimal value = (BigDecimal)m.invoke(list.get(0));
                if(null != value){
                    setCol1.invoke(asset,new Object[] {String.valueOf(value)});
                }
                else{
                    setCol1.invoke(asset,new Object[] {""});
                }
                value = (BigDecimal)m.invoke(list.get(1));

                //财务信息结构分析时传的状态为33
                if(null != value && !type.equals(33)){
                    setCol2.invoke(asset,new Object[] {String.valueOf(value)});
                }else if(null != value && type.equals(33)){
                    setCol2.invoke(asset,new Object[] {String.valueOf(value)+"%"});
                }
                else{
                    setCol2.invoke(asset,new Object[] {""});
                }
                value = (BigDecimal)m.invoke(list.get(2));
                if(null != value){
                    setCol3.invoke(asset,new Object[] {String.valueOf(value)});
                }
                else{
                    setCol3.invoke(asset,new Object[] {""});
                }
                value = (BigDecimal)m.invoke(list.get(3));

                //财务信息结构分析时传的状态为33
                if(null != value && !type.equals(33)){
                    setCol4.invoke(asset,new Object[] {String.valueOf(value)});
                }else if(null != value && type.equals(33)){
                    setCol4.invoke(asset,new Object[] {String.valueOf(value)+"%"});
                }
                else{
                    setCol4.invoke(asset,new Object[] {""});
                }
                if(type.equals(1)){
                    Method setCol5 = asset.getClass().getMethod("setCol5", new Class[] {String.class});
                    value = (BigDecimal)m.invoke(list.get(4));
                    if(null != value){
                        setCol5.invoke(asset,new Object[] {String.valueOf(value)});
                    }
                    else{
                        setCol5.invoke(asset,new Object[] {""});
                    }
                }
                //财务信息结构分析时传的状态为33
                if(type.equals(33)){
                    Method setCol5 = asset.getClass().getMethod("setCol5", new Class[] {String.class});
                    value = (BigDecimal)m.invoke(list.get(4));
                    if(null != value){
                        setCol5.invoke(asset,new Object[] {String.valueOf(value)+"%"});
                    }
                    else{
                        setCol5.invoke(asset,new Object[] {""});
                    }
                }
            }
            resp.add(asset);
        }
        
        return resp;
    }
    
    /**
     * 对对象里的数据做除法
     *
     * @param model 数据对象
     * @param div 除数
     */
    public static void objectDiv(Object model,BigDecimal div) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException,
            InvocationTargetException {
        Field[] field = model.getClass().getDeclaredFields();        //获取实体类的所有属性，返回Field数组
        for(int j=0 ; j<field.length ; j++){     //遍历所有属性
            String name = field[j].getName();    //获取属性的名字
            
            name = name.substring(0,1).toUpperCase()+name.substring(1); //将属性的首字符大写，方便构造get，set方法
            String type = field[j].getGenericType().toString();    //获取属性的类型
            if(type.equals("class java.math.BigDecimal")){   //如果type是类类型，则前面包含"class "，后面跟类名
                Method m = model.getClass().getMethod("get"+name);
                BigDecimal value = (BigDecimal) m.invoke(model);    //调用getter方法获取属性值
                if(value != null){
                    value = value.divide(div, Constant.RETAIN_DECIMAL_DIGIT_FOUR, RoundingMode.HALF_UP);
                    Method set = model.getClass().getMethod("set"+name, new Class[] {BigDecimal.class});
                    set.invoke(model,new Object[] {value});
                }
            }
        }
    }

}
